Skip to content

Conversation

@errose28
Copy link
Contributor

What changes were proposed in this pull request?

The on demand container scanner was originally implemented as a static instance so that it could be easily triggered from anywhere in the code. This is now causing problems for reconciliation testing where multiple replicas exist in the same process. We are invoking on demand scans for each replica after it is reconciled, and these scans for different replicas are hitting the same container scanner concurrently. This is required for tests to pass in #7490.

Due to the layout of the datanode code, it is difficult to get items like this to all places where they are needed, which is why the on demand scanner was initially static. I have attempted to remedy this issue by adding a scan handler which can be triggered from the ContainerSet. ContainerSet was chosen because it is both created by the OzoneContainer which also initializes the scanners, and available in most locations in the datanode.

What is the link to the Apache JIRA

HDDS-12849

How was this patch tested?

Existing unit and integration tests for on demand container scanner pass. New unit test added.

Copy link
Member

@aswinshakil aswinshakil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @errose28 for working on this. Overall, the changes look good. I have left some minor comments.

}
OnDemandContainerDataScanner.init(c, controller);
onDemandScanner = new OnDemandContainerDataScanner(c, controller);
containerSet.registerContainerScanHandler(onDemandScanner::scanContainer);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pass the OnDemandContainerDataScanner itself here instead of using Consumer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but I would rather keep the coupling between the two classes looser. We could make a scanner interface but it would only have one method and only be used here. The consumer was a light-weight way to get this same functionality.

@errose28
Copy link
Contributor Author

Thanks for the review @aswinshakil. Comments have been addressed in the latest commit.

@aswinshakil aswinshakil marked this pull request as ready for review April 22, 2025 08:16
Copy link
Member

@aswinshakil aswinshakil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @errose28 for the update. LGTM. Pending CI

@kerneltime kerneltime merged commit 229e5c9 into apache:HDDS-10239-container-reconciliation Apr 22, 2025
43 checks passed
errose28 added a commit to errose28/ozone that referenced this pull request May 6, 2025
…anner-builds-mt

* HDDS-10239-container-reconciliation:
  HDDS-12849. On demand container scanner should not be static (apache#8296)
  HDDS-12745. Container checksum should be reported during container close and DN restart (apache#8204)

Conflicts:
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/OnDemandContainerDataScanner.java
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/OzoneContainer.java
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerSet.java
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOnDemandContainerDataScanner.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants